package com.lm.ledger.dao;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		

	}

	private String getWhereClouse(String formId,String locId,String trxDate,String trxType,String status){
		/*
		String formId = "ABC1";  		//A
		String locId = null ;		//B
		String trxDate = null ;		//C
		String trxType = null ;		//D
		String status = null;		//E
		*/
		String where = "";
		if(formId != null && locId !=null && trxDate !=null && trxType !=null && status !=null){
			// System.out.println("formId != null && locId !=null && trxDate !=null && trxType !=null && status !=null");
			where = "and formId=? and account.LocationID=? and TransactionDate=? and TransactionType=? and account.status=?";
		}
		else if(formId != null && locId !=null && trxDate !=null && trxType !=null){
			// System.out.println("formId != null && locId !=null && trxDate !=null && trxType !=null");
			where = "and formId=? and account.LocationID=? and TransactionDate=? and TransactionType=?";
		}else if(formId != null && locId !=null && trxType !=null && status !=null){
			// System.out.println("trxDate id is null");
			where = "and formId=? and account.LocationID=? and TransactionType=? and account.status=?";
		}else if(formId != null && trxDate !=null && trxType !=null && status !=null){
			// System.out.println("trxType id is null");
			where = "and formId=? and TransactionDate=? and TransactionType=? and account.status=?";
		}else if(formId != null && locId !=null && trxDate !=null && status !=null){
			// System.out.println("gorm id is blank");
			where = "and formId=? and account.LocationID=? and TransactionDate=? and account.status=?";
		}else if(locId !=null && trxDate !=null && trxType !=null && status !=null){
			// System.out.println("form id is null");
			where = "and account.LocationID=? and TransactionDate=? and TransactionType=? and account.status=?";
		}
		else if(formId != null && locId !=null && trxDate !=null){
			// System.out.println("locId id is null");
			where = "and formId=? and account.LocationID=? and TransactionDate=?";
		}else if(formId != null && locId !=null && trxType !=null){
			// System.out.println("trxDate id is null");
			where = "and formId=? and account.LocationID=? and TransactionType=?";
		}else if(formId != null && locId !=null && status !=null){
			// System.out.println("form id is null");
			where = "and formId=? and account.LocationID=? and account.status=?";
		}else if(formId != null && trxDate !=null && status !=null){
			// System.out.println("locId id is null");
			where = "and formId=? and TransactionDate=? and account.status=?";
		}else if(formId !=null && trxDate !=null && trxType !=null){
			// System.out.println("form id is null");
			where = "and formId=? and TransactionDate=? and TransactionType=?";
		}else if(formId != null && trxType !=null && status !=null){
			// System.out.println("trxDate id is null");
			where = "and formId=? and TransactionType=? and account.status=?";
		}else if(locId !=null && trxDate !=null && trxType !=null){
			// System.out.println("form id is null");
			where = "and account.LocationID=? and TransactionDate=? and TransactionType=?";
		}else if(locId !=null && trxDate !=null && status !=null){
			// System.out.println("locId id is null");
			where = "and account.LocationID=? and TransactionDate=? and account.status=?";
		}else if(trxDate !=null && trxType !=null && status !=null){
			// System.out.println("TransactionDate id is null");
			where = "and TransactionDate=? and TransactionType=? and account.status=?";
		}
		else if(formId != null && locId !=null){
			// System.out.println("locId id is null");
			where = "and formId=? and account.LocationID=?";
		}else if(trxType !=null && status !=null){
			// System.out.println("trxDate id is null");
			where = "and TransactionType=? and account.status=?";
		}else if(formId != null && trxDate !=null){
			// System.out.println("form id is null");
			where = "and formId=? and TransactionDate=?";
		}else if(formId != null&& trxType !=null){
			// System.out.println("locId id is null");
			where = "and formId=? and TransactionType=?";
		}else if(formId != null && status !=null){
			// System.out.println("trxDate id is null");
			where = "and formId=? and account.status=?";
		}else if(locId !=null && trxDate !=null){
			// System.out.println("form id is null");
			where = "and account.LocationID=? and TransactionDate=?";
		}else if(locId !=null && trxType !=null){
			// System.out.println("locId id is null");
			where = "and account.LocationID=? and TransactionType=?";
		}else if(locId !=null && status !=null){
			// System.out.println("trxDate id is null");
			where = "and account.LocationID=? and account.status=?";
		}else if(trxDate !=null && trxType !=null){
			// System.out.println("form id is null");
			where = " and TransactionDate=? and TransactionType=?";
		}else if(trxDate !=null && status !=null){
			// System.out.println("locId id is null");
			where = "and TransactionDate=? and account.status=?";
		}
		else if(formId != null){
			// System.out.println("trxDate id is null");
			where = "and formId=?";
		}else if(status != null){
			// System.out.println("form id is null");
			where = "and account.status=?";
		}else if(locId != null){
			// System.out.println("locId id is null");
			where = "and account.LocationID=?";
		}else if(trxDate != null){
			// System.out.println("trxDate id is null");
			where = "and TransactionDate=?";
		}else if(trxType != null){
			// System.out.println("trxDate id is null");
			where = "and TransactionType=?";
		}
		
		return where;
	}
}
